<!doctype html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>首页</title>
    <link rel="stylesheet" type="text/css" href="./css/api.css" />
    <link rel="stylesheet" type="text/css" href="./css/aui.css" />
    <link rel="stylesheet" type="text/css" href="./css/font-awesome.min.css" />
    <link rel="stylesheet" type="text/css" href="./css/style.css" />
    <script type="text/javascript" src="./script/api.js"></script>
    <script type="text/javascript" src="./script/aui-tab.js"></script>
    <link rel="stylesheet" type="text/css" href="./css/aui-slide.css" />
    <script type="text/javascript" src="./script/aui-slide.js"></script>
    <script type="text/javascript" src="./script/base.js"></script>
    <script type="text/javascript" src="./script/doT.min.js"></script>
    <script type="text/javascript" src="./script/jquery-3.2.0.js"></script>
    <script type="text/javascript">
        function closeWin() {
            api.closeWin({});
        };
    </script>
</head>

<body>

    <!-- 首页公告 -->
    <div class="index-notice">
        <span class="fa fa-volume-up"></span>
        <a tapmode onclick="notice_detail()" class="index-notice-body">金可贷上线公告</a>
        <a tapmode onclick="notice_list()" class="index-notice-more">更多<i class="fa fa-angle-right"></i></a>
    </div>

    <div class="aui-row index-nav">
        <ul>

            <li class="aui-col-5" tapmode onclick="news_list(32)">
                <img src="image/index-nav/0.png">
                <p>资讯中心</p>
            </li>
            <li class="aui-col-5" tapmode onclick="news_index(298)">
                <img src="image/index-nav/1.png">
                <p>平台信息</p>
            </li>
            <li class="aui-col-5" tapmode onclick="retprt(36)">
                <img src="image/index-nav/2.png">
                <p>公司报表</p>
            </li>
            <li class="aui-col-5" tapmode onclick="news_index(299)">
                <img src="image/index-nav/3.png">
                <p>公司简介</p>
            </li>
            <li class="aui-col-5" tapmode onclick="news_index(302)">
                <img src="image/index-nav/4.png">
                <p>安全保障</p>
            </li>
            <li class="aui-col-5" tapmode onclick="news_index(300)">
                <img src="image/index-nav/5.png">
                <p>高管团队</p>
            </li>
            <li class="aui-col-5" tapmode onclick="news_index(66)">
                <img src="image/index-nav/6.png">
                <p>联系我们</p>
            </li>
            <li class="aui-col-5" tapmode onclick="news_report(297)">
                <img src="image/index-nav/7.png">
                <p>荣誉资质</p>
            </li>
            <li class="aui-col-5" tapmode onclick="news_index(301)">
                <img src="image/index-nav/8.png">
                <p>发展历程</p>
            </li>
            <li class="aui-col-5" tapmode onclick="news_index(92)">
                <img src="image/index-nav/9.png">
                <p>合作机构</p>
            </li>
        </ul>
    </div>


    <!-- 新手专区 -->
    <div class="index-sprog">
        <!-- <div class="index-sprog-t">
            <a tapmode onclick="">专区详情<i class="fa fa-angle-right"></i></a>
        </div> -->
        <ul>
            <li tapmode onclick="news_region()">
                <img src="image/index-icon-1.png">
                <dl>
                    <dt>送超值红包</dt>
                    <dd>超值红包等你来拿</dd>
                    <div class="more">立即领取<i class="fa fa-angle-right"></i></div>
                </dl>
            </li>
            <li tapmode onclick="tiyanjin()">
                <img src="image/index-icon-2.png">
                <dl>
                    <dt>送10000体验金</dt>
                    <dd>利息全部带回家</dd>
                    <div class="more">立即领取<i class="fa fa-angle-right"></i></div>
                </dl>
            </li>
        </ul>
    </div>
    <div class="index-sprog-d" id="ha" style="display: none;"><i class="fa fa-shield"></i>哈尔滨银行存管，资金安全有保障</div>

    <div id="list"></div>
    <!-- 上拉查看 -->
    <div class="index-d" id="la" style="display: none;">
        <i class="fa fa-hand-pointer-o"></i>上拉查看更多内容
    </div>

</body>

<script type="text/template" id="template">
    <!-- 首页列表 -->
    <div class="index-list">
        <ul>
            {{~it:value:index}}
            <li tapmode onclick="licai_sanbiao('{{=value.id}}')">
                <div class="t">{{=value.name}} {{=value.deal_sn}}</div>
                <div class="m">
                    <div class="m-l">{{=value.rate}}<i>%</i></div>
                    <div class="m-r"><span>{{=value.repay_time}}</span>个月<i></i>{{? value.loantype==0}}等额本息{{?? value.loantype==1}}每月付息，到期还本{{?? value.loantype==2}}到期还本息{{?? value.loantype==3}}先息后本{{??}}{{?}}</div>
                </div>
                <div class="j">
                    <div class="aui-progress">
                        <div class="aui-progress-bar" style="width:{{=value.progress_point}}%;"></div>
                    </div>
                    <p>{{=value.progress_point}}%</p>
                </div>
                <div class="d">
                    <!-- <i class="fa fa-exclamation-circle"></i>借款人可能提前还款 --><span>元</span><span class="money2">{{=value.surplusmoney}}</span><span>剩余</span>
                </div>
            </li>
            {{~}}
        </ul>
    </div>
</script>

<div class="foot-p" style="width:100%; text-align:center; padding:30px 0 0; font-size:12px; color:#999; clear:both;">
  Copyright © 佳木斯可大投资管理有限公司
</div>
</body>

<script type="text/javascript">
    var urlArray = new Array();
    var array = new Array();
    var idarray = new Array();
    var test;

    function openClub() {
        var delay = 0;
        if (api.systemType != 'ios') {
            // delay = 300;
        }
        api.openWin({
            name: 'club_win',
            url: './html/index_frm.html',
            bounces: false,
            delay: delay,
            slidBackEnabled: true,
            vScrollBarEnabled: false,
            progress: {
                type: "page"
            }
        });
    };

    apiready = function() {
        var tab = new auiTab({
            element: document.getElementById("footer")
        });
        // 启动页

        if (api.systemType == 'ios') {
            var isLock = $api.getStorage('welcome');
            if (!isLock) {
                iosWecomePage();
            }

        } else {
            wecomePage();

        }


        //推送
        // addPush();

        //添加从后台进入前台手势解锁


        //获取数据

        var scrollShow = false;
        getScrollPicture();
        //轮播图显示
        ScrollPicture(scrollShow);

        api.ajax({
            url: 'http://www.big-wealth.com/index.php?ctl=app_deal&act=config',
            method: 'post',
        },function(ret, err){
            if (ret) {
                // alert( JSON.stringify( ret ) );
                var isHide = ret.status;
                if (api.systemType != 'ios' || isHide == 1) {
                // delay = 300;
                load_list();
                addObserver();
                down_refresh();
                $("#ha").show();
                $("#la").show();
            }
        } else {
                // alert( JSON.stringify( err ) );
            }
        });
        
    };


    //ios手势验证





    // 加载列表
    function load_list() {

        api.showProgress({
            style: 'default',
            animationType: 'fade',
            title: '努力加载中...',
            text: '先喝杯茶...',
            modal: false
        });

        api.ajax({
            url: webAddress + '/member.php?ctl=app_deal&act=deal_index',
            method: 'get',
        }, function(ret, err) {

            if (ret) {

                if (ret.status == 0) {
                    alert(ret.info);
                } else {
                    api.hideProgress();
                    api.refreshHeaderLoadDone();
                    updateList(ret.deal.list);
                }
            } else {
                alert(err.msg);
                api.refreshHeaderLoadDone();
                api.hideProgress();
                // api.closeWin({
                // });
            }
        });
    }

    // doT
    function updateList(data) {
        var template = $api.byId('template');
        var dotFn = doT.template(template.innerHTML);
        var html = dotFn(data);
        var list = $api.byId('list');
        $api.html(list, html);
    }

    function addPush() {
        //设置消息监听，若iOS应用在前台运行，此时收到推送后也通过此方法回调
        var ajpush = api.require('ajpush');
        //初始化
        ajpush.init(function(ret) {
            if (ret && ret.status) {
                //success
            }
        });
        ajpush.setListener(
            function(ret) {
                var id = ret.id;
                var title = ret.title;
                var content = ret.content;
                var extra = ret.extra;
            }
        );
        //集成了JPush SDK的应用程序在第一次成功注册到JPush服务器时，
        //JPush服务器会给客户端返回一个唯一的该设备的标识RegistrationID。
        //JPush SDK会以广播的形式发送RegistrationID到应用程序。
        //应用程序可以把此RegistrationID保存于自己的应用服务器上，
        //然后就可以根据 RegistrationID来向设备推送消息或者通知
        ajpush.getRegistrationId(function(ret) {
            var registrationId = ret.id;
        });

        api.addEventListener({
            name: 'appintent'
        }, function(ret, err) {
            if (ret && ret.appParam.ajpush) {
                var ajpush = ret.appParam.ajpush;
                var id = ajpush.id;
                var title = ajpush.title;
                var content = ajpush.content;
                var extra = ajpush.extra;
            }
        })
    }

    //启动页
    function iosWecomePage() {
        api.openFrameGroup({
            name: 'welcome',
            rect: {
                x: 0,
                y: 0,
                w: 'auto',
                h: 'auto'
            },
            frames: [{
                name: 'w1',
                url: 'w1.html',
                bgColor: 'widget://image/w1.jpg'
            }, {
                name: 'w2',
                url: 'w2.html',
                bgColor: 'widget://image/l2.jpg'
            }, {
                name: 'w3',
                url: 'w3.html',
                bgColor: 'widget://image/l3.jpg'
            }, {
                name: 'w4',
                url: './html/w4.html',
                bgColor: 'widget://image/l4.jpg'
            }]
        }, function(ret, err) {

            $api.setStorage('welcome', 1);

        });
    }


    //启动页
    function wecomePage() {
        //

        var WelcomePage = api.require('welcomePage');
        WelcomePage.openWelcomePage({
            isFullscreen: true, //是否全屏(全屏不显示状态栏)  默认false
            AnimationType: 'Default', //动画类型   'Default默认', 'DepthPage深入浅出', 'Cube立方体', 'Rotate旋转','Accordion左右折叠',
            //'InRightUp右上角进入' , 'InRightDown右下角进入', 'ZoomOutPage淡入淡出'
            imgs: ['widget://image/w1.jpg', 'widget://image/l2.jpg', 'widget://image/l3.jpg', 'widget://image/l4.jpg'],
            setting: {
                isShow: true, // 是否显示页面点 默认不显示
                // SelectedImg: 'widget://image/w3.png',
                // NotSelectedImg: 'widget://image/w2.png',
                ImgSize: 30, // 图片size
                ImgSpacing: 30 // 图片之间的间隔
            }
        }, function(ret, err) {
            if (ret) {} else {}
        });
    }


    //轮播图ajax
    function getScrollPicture() {

        //ajax
        api.ajax({
            url: 'http://www.big-wealth.com/index.php?ctl=app_article&act=slide_index',
            method: 'post',
        }, function(ret, err) {
            if (ret) {
                var data = ret.slide;
                for (var i = 0; i < data.length; i++) {
                    array[i] = data[i].img.replace(/.\/public\/attachment/g, 'http://www.big-wealth.com/public/attachment');
                    urlArray[i] = data[i].data;
                }
            }
            test = urlArray;
            var scrollShow = true;
            ScrollPicture(array, data, urlArray, scrollShow);
        });

    }


    //轮播图
    function ScrollPicture(array, data, urlArray, scrollShow) {
        var UIScrollPicture = api.require('UIScrollPicture');
        if (!scrollShow) {
            UIScrollPicture.open({
                rect: {
                    x: 0,
                    y: 0,
                    w: api.winWidth,
                    h: api.winWidth / 2
                },
                data: {
                    paths: [
                        'widget://image/l1.png',
                        'widget://image/l2.png',
                        'widget://image/l3.png',
                    ],
                },
                styles: {
                    caption: {
                        height: api.winWidth / 2,
                        color: '#E0FFFF',
                        size: 13,
                        bgColor: '#696969',
                        position: 'bottom'
                    },
                    indicator: {
                        align: 'center',
                        color: '#FFFFFF',
                        activeColor: '#DA70D6'
                    }
                },
                placeholderImg: 'widget://image/l1.png',
                contentMode: 'scaleToFill',
                interval: 3,
                fixedOn: 'index',
                loop: true,
                fixed: false
            }, function(ret, err) {
                if (ret) {


                    // if (ret.eventType == 'click' && test) {
                    //     api.openWin({
                    //         name: 'web',
                    //         url: './web-url.html',
                    //         pageParam: {
                    //             url: test[ret.index]
                    //         }
                    //     });
                    // }

                }
            });
        } else {
            UIScrollPicture.reloadData({
                data: {
                    paths: array,
                }
            });
        };
        //修改尺寸
        var a = api.winWidth / 2;
        $('.index-notice').css('margin-top', a + 10);
    };

    function licai_list() {
        var delay = 0;
        if (api.systemType != 'ios') {
            // delay = 300;
        }
        api.openWin({
            name: 'licai_list',
            url: './licai-list.html',
            bounces: false,
            delay: delay,
            slidBackEnabled: true,
            vScrollBarEnabled: false,
            progress: {
                type: "page"
            }
        });
    };

    function news_report(index) {
        var index = index;
        api.openWin({
            name: 'news_indexCon',
            url: './news_indexCon.html',
            pageParam: {
                index: index,
                title: "荣誉资质"
            }
        });




        // if (api.systemType != 'ios') {
        //     // delay = 300;
        //     api.confirm({
        //         title: '是否跳转到pc版报表页面？',
        //         msg: '请到公司官网http://www.big-wealth.com查看',
        //         buttons: ['确定', '取消']
        //     }, function(ret, err) {
        //         var index = ret.buttonIndex;
        //         if (index == 1) {
        //             api.openApp({
        //                 androidPkg: 'android.intent.action.VIEW',
        //                 mimeType: 'text/html',
        //                 uri: 'http://www.big-wealth.com/index.php?ctl=notice&act=report'
        //             }, function(ret, err) {
        //
        //             });
        //         }
        //     });
        // } else {
        //     //ios
        //
        //     api.confirm({
        //         title: '是否跳转到pc版报表页面？',
        //         msg: '请到公司官网http://www.big-wealth.com查看',
        //         buttons: ['确定', '取消']
        //     }, function(ret, err) {
        //         var index = ret.buttonIndex;
        //         if (index == 1) {
        //             api.openApp({
        //                 iosUrl: 'http://www.big-wealth.com/index.php?ctl=notice&act=report', //打开微信的，其中weixin为微信的URL Scheme
        //                 appParam: {
        //                     appParam: 'app参数'
        //                 }
        //             });
        //
        //
        //         }
        //     });
        //
        // }


    }

    function news_index(n) {
        var delay = 0;
        if (api.systemType != 'ios') {
            // delay = 300;
        }

        var title;
        if (n == '32') {
            title = '资讯中心';
        } else if (n == '298') {
            title = '平台信息';
        } else if (n == '36') {
            title = '公司报表';
        } else if (n == '299') {
            title = '公司简介';
        } else if (n == '302') {
            title = '安全保障';
        } else if (n == '300') {
            title = '高管团队';
        } else if (n == '66') {
            title = '联系我们';
        } else if (n == '297') {
            title = '荣誉资质';
        } else if (n == '301') {
            title = '发展历程';
        } else if (n == '92') {
            title = '合作机构';
        }


        api.openWin({
            name: 'news_index',
            url: './news_index.html',
            bounces: false,
            delay: delay,
            slidBackEnabled: true,
            vScrollBarEnabled: false,
            pageParam: {
                id: n,
                title: title
            }
        });


    }


    // 更多
    function more_list() {
        var delay = 0;
        if (api.systemType != 'ios') {
            // delay = 300;
        }
        api.openWin({
            name: 'more_list',
            url: './more-list.html',
            bounces: false,
            delay: delay,
            slidBackEnabled: true,
            vScrollBarEnabled: false,
            progress: {
                type: "page"
            }
        });
    };


    //轮播图



    // 可删除
    // 散标
    function licai_sanbiao(id) {
        var delay = 0;
        if (api.systemType != 'ios') {
            // delay = 300;
        }
        api.openWin({
            name: 'licai_sanbiao',
            url: './licai-sanbiao.html',
            pageParam: {
                id: id
            }
        });
    };
    // 最新活动
    function activity() {
        var delay = 0;
        if (api.systemType != 'ios') {
            // delay = 300;
        }
        api.openWin({
            name: 'activity',
            url: './activity.html',
            bounces: false,
            delay: delay,
            slidBackEnabled: true,
            vScrollBarEnabled: false,
            progress: {
                type: "page"
            }
        });
    };

    //安全中心
    function safety() {
        var delay = 0;
        if (api.systemType != 'ios') {
            // delay = 300;
        }
        api.openWin({
            name: 'safety-list',
            url: './safety-list.html',
            bounces: false,
            delay: delay,
            slidBackEnabled: true,
            vScrollBarEnabled: false,
            progress: {
                type: "page"
            }
        });
    }

    function course(n) {
        var delay = 0;
        if (api.systemType != 'ios') {
            // delay = 300;
        }


        api.openWin({
            name: 'course',
            url: './course.html',
            bounces: false,
            delay: delay,
            slidBackEnabled: true,
            vScrollBarEnabled: false,
            pageParam: {
                title: n
            }
        });




    }

    function safety_pic() {
        var delay = 0;
        if (api.systemType != 'ios') {
            // delay = 300;
        }
        api.openWin({
            name: 'safety-list-frame',
            url: './safety-list-frame.html',
            bounces: false,
            delay: delay,
            slidBackEnabled: true,
            vScrollBarEnabled: false,
            progress: {
                type: "page"
            }
        });
    }

    //公司报表
    function retprt(n) {
      title = '公司报表';
        api.openWin({
            name: 'report-list',
            url: './report-list.html',
            bounces: false,
            delay: 0,
            slidBackEnabled: true,
            vScrollBarEnabled: false,
            pageParam: {
                page: n,
                title: title
            }
        });

    }

    // 资讯中心
    function news_list(n) {

        var delay = 0;
        if (api.systemType != 'ios') {
            // delay = 300;
        }

        var title;
        if (n == '32') {
            title = '资讯中心';
        } else if (n == '298') {
            title = '平台信息';
        } else if (n == '36') {
            title = '公司报表';
        } else if (n == '299') {
            title = '公司简介';
        } else if (n == '302') {
            title = '安全保障';
        } else if (n == '300') {
            title = '高管团队';
        } else if (n == '66') {
            title = '联系我们';
        } else if (n == '297') {
            title = '荣誉资质';
        } else if (n == '301') {
            title = '发展历程';
        } else if (n == '92') {
            title = '合作机构';
        }

        api.openWin({
            name: 'news_list',
            url: './news-list.html',
            bounces: false,
            delay: delay,
            slidBackEnabled: true,
            vScrollBarEnabled: false,
            pageParam: {
                page: n,
                title: title
            }
        });
    };

    function notice(name, url) {
        var delay = 0;
        if (api.systemType != 'ios') {
            // delay = 300;
        }
        api.openWin({
            name: name,
            url: url,
            bounces: false,
            delay: delay,
            slidBackEnabled: true,
            vScrollBarEnabled: false,
            progress: {
                type: "page"
            }
        });
    }
    // 公告中心
    function notice_list() {
        var delay = 0;
        if (api.systemType != 'ios') {
            // delay = 300;
        }
        api.openWin({
            name: 'notice_list',
            url: './notice-list.html',
            bounces: false,
            delay: delay,
            slidBackEnabled: true,
            vScrollBarEnabled: false,
            progress: {
                type: "page"
            }
        });
    };
    // 公告详情
    function notice_detail() {
        var delay = 0;
        if (api.systemType != 'ios') {
            // delay = 300;
        }
        api.openWin({
            name: 'notice_detail',
            url: './notice-detail.html',
            bounces: false,
            delay: delay,
            slidBackEnabled: true,
            vScrollBarEnabled: false,
            progress: {
                type: "page"
            }
        });
    };
    // 新手专区
    function news_region() {
        var delay = 0;
        if (api.systemType != 'ios') {
            // delay = 300;
        }
        api.openWin({
            name: 'news_region',
            url: './news-region.html',
            bounces: false,
            delay: delay,
            slidBackEnabled: true,
            vScrollBarEnabled: false,
            progress: {
                type: "page"
            }
        });
    };

    function tiyanjin() {
        var delay = 0;
        if (api.systemType != 'ios') {
            // delay = 300;
        }
        api.openWin({
            name: 'tiyanjin',
            url: './tiyanjin.html',
            bounces: false,
            delay: delay,
            slidBackEnabled: true,
            vScrollBarEnabled: false,
            progress: {
                type: "page"
            }
        });
    };

    function addObserver() {
        api.addEventListener({
            name: 'scrolltobottom',
            extra: {
                threshold: 0
            }
        }, function(ret, err) {
            var setSele = 'changeSelect_licai();';
            api.execScript({
                name: 'home',
                script: setSele,
            });
        });
    }

    // 下拉刷新
    function down_refresh() {

        api.setRefreshHeaderInfo({
            visible: true,
            // loadingImg: 'widget://image/refresh.png',
            bgColor: '#ccc',
            textColor: '#fff',
            textDown: '下拉刷新...',
            textUp: '松开刷新...',
            showTime: true
        }, function(ret, err) {
            getScrollPicture();
            load_list();
        });
    }
</script>
<script type="text/javascript">
    var slide = new auiSlide({
        container: document.getElementById("aui-slide"),
        // "width":300,
        "height": 260,
        "speed": 300,
        "pageShow": true,
        "pageStyle": 'dot',
        "loop": true,
        'dotPosition': 'center',
        currentPage: currentFun
    })

    function currentFun(index) {
        console.log(index);
    }
</script>

</html>
